<template>
  <FormItemWrapper v-bind="$attrs" :widget="widget" :designer="designer">
    <Switch
      v-model:checked="widgetProps.value"
      :checkedValue="widgetProps.checkedValue || true"
      :checkedChildren="widgetProps.checkedText"
      :unCheckedValue="widgetProps.unCheckedValue || false"
      :unCheckedChildren="widgetProps.unCheckedText"
      :disabled="widgetProps.disabled"
      size="default"
    />
  </FormItemWrapper>
</template>
<script lang="ts" name="switch-widget" setup>
  import { ref } from "vue"
  import { useI18n } from "/@/hooks/web/useI18n"
  import { Icon } from "/@/components/Icon"
  import { Switch } from "ant-design-vue"
  import { useAttrs } from "/@/hooks/core/useAttrs"
  import FormItemWrapper from "./FormItemWrapper.vue"
  import type { Designer } from "../../type"
  import { useWidget } from "../useWidget"
  const props = defineProps({
    widget: { type: Object, default: {} },
    designer: { type: Object as () => Designer },
  })
  const widgetProps = props.widget.props
  const attrs = useAttrs()
  const { watchDefaultValue } = useWidget()
  watchDefaultValue(props)
</script>

<style lang="less"></style>
